package com.sunwhite.kaikeba.interceptor;

import com.sunwhite.kaikeba.utils.ResponseResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ExceptionInterceptor {
    private final static Logger logger= LoggerFactory.getLogger(ExceptionInterceptor.class);

    @ExceptionHandler(Exception.class)
    public ResponseResult GlobleException(Exception e){
        e.printStackTrace();
        logger.info("异常打印：{}",e.getMessage());
        return ResponseResult.build("全局异常拦截器");
    }
}
